<?php
namespace LDL\Twspider\E;
//use LDL\Twspider\E\SpiderFactInte ; 
class FixThreadLoad {
	private $files=[

		"src/LDL/Twspider/C/StackArray.php",
		"src/LDL/Twspider/C/EventDispatcher.php",
		"src/LDL/Twspider/E/ConsoleLog.php",
		"src/LDL/Twspider/C/StaticManager.php",
		"src/LDL/Twspider/C/Timer/TimeJob.php",
		"src/LDL/Twspider/C/Taskrun.php",

		"src/VDB/Spider"
		/* "vendor/guzzlehttp/guzzle/src"
		,"vendor/guzzlehttp/psr7/src"
		,"vendor/guzzlehttp/promises/src"
		
		,"vendor/symfony/finder"
		,"vendor/symfony/dom-crawler"
		,"vendor/symfony/event-dispatcher"
		 */

	//	,"vendor/symfony/symfony/src/Symfony/Component/"
		//,"vendor/guzzlehttp/promises/src"
		//,"vendor/guzzlehttp/promises/src"
		//,"vendor/guzzlehttp/promises/src"
	];
	public static function fix($files=array()){
		new FixThreadLoad($files) ;
	}
	private static function incl($path){	
			if(is_dir($path)){
				if(substr($path,"-1")!="/"){
					$path.="/";
				}
				foreach (glob($path."*") as $fr)
				{
					self::incl($fr);					
				}
			}else{
				$pathinfo=pathinfo($path);
				
				if(isset($pathinfo['extension']))
				{
					$rf = $pathinfo['extension'] ;
					
				}else{
				return ;}
				$rf=strtolower($rf);
				if($rf=="php"){
					include_once $path;
				}
			}
			
			
	}
	public function __construct($files=array()){
		$pf=__DIR__."/../../../../";
		//本工程文件 
		foreach ($this->files as $f) {
			self::incl($pf.$f) ;
		}
		//对外的 工程使用者的文件 
		foreach($files as $f){
			self::incl($f) ;
		}

	}
}
